package devices

import (
	"context"
	"device_srv/device"
	"device_srv/internal/dao"
	"device_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type DevicesUpdateLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDevicesUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DevicesUpdateLogic {
	return &DevicesUpdateLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// DevicesUpdate 设备信息修改
func (l *DevicesUpdateLogic) DevicesUpdate(in *device.DevicesUpdateRequest) (*device.DevicesUpdateResponse, error) {
	//调用业务逻辑
	update, err := dao.DevicesUpdate(in)
	if err != nil {
		return nil, err
	}
	return &device.DevicesUpdateResponse{
		Id: int64(update.Id),
	}, nil
}
